/**
 * Below is a sample adapter for connecting with a webservice.
 */

var myRemoteAdapter={
    server:BASE_URL,
    save:function(obj,callback,foo){
        $.get(this.server+"todo.php?axt=save&data="+encodeURIComponent(JSON.stringify(obj)),
            function(id){
                obj.id=id;
                $(document).trigger(obj.name + ":save", obj);
                if(callback)
                    callback(obj);
            }
        );
    },
    fetch:function(item,callback){
        $.get(BASE_URL+"event?id="+encodeURIComponent(item.id),
            function(obj){
                
                obj=JSON.parse(obj);
                if(callback)
                    callback(obj);
            }
        );
    },
    detailnya:function(item,callback){
        
          $.get(BASE_URL+"events_package?id="+encodeURIComponent(item.id),
            function(obj){
                
                obj=JSON.parse(obj);
                if(callback)
                    callback(obj);
            }
        );
         
    },
    package_detail:function(item,callback){
         
          $.get(BASE_URL+"events_package_detail?id="+encodeURIComponent(item.id),
            function(obj){ 
                
                obj=JSON.parse(obj);   
                if(callback)
                     
                    callback(obj);
            }
        );
         
    },
    fetchAll:function(id,callback){
         
        $.get(BASE_URL+"events",
            function(obj){
               
                obj=JSON.parse(obj);
                if(callback)
                    callback(obj);
            }
        );
    },
    remove:function(obj,callback){
        $.get(BASE_URL+"todo.php?axt=delete&data="+encodeURIComponent(obj.id),
            function(obj){
                $(document).trigger(obj.name + ":remove", obj.id);
                obj=JSON.parse(obj);
                if(callback)
                    callback(obj);
            }
        );
    }
}


Event1 =  $.mvc.model.extend("event",{
    validate:function(opts){
        if(opts&&opts.trigger)
            return "error validating";
        return true;
    },
    
    eventID: '',
    eventTitle: '',
    dateCreated: '',
    dateModified: '',
    eventDate: '',
    eventEnd: '',
    time: '',
    location: '',
    description: '',
    excerpt: '',
    userID: '',
    groupID: '',
    tags: '',
    published: '',
    featured: '',
    deleted: '',
    siteID: '',
    showImages: '',
    imageBanner: '',
    image: '',
    eventcatID: '',
    eventQTY: '',
    eventTop: '',
    eventbalanceQTY: '',
    merchantBranchID: '',
    eventYoutubeurl: '',
    eventCode: '',
    eventcatName: '',
    eventcatDesc: '',
    qtyavailable: '',
    packdel: '',
    price: '',
    price_formatted: '', 
    eventpackageTitle:'',
    price:'',
    winsPrice:'',
    vipPrice:'',
    retailPrice:'',
    eventpackageQTY:'',
    eventpackagebalanceQTY:'',
    eventpackageID:''
    
}, myRemoteAdapter);

var event1 = new Event1();



//-----------


Eventpack =  $.mvc.model.extend("event",{
    validate:function(opts){
        if(opts&&opts.trigger)
            return "error validating";
        return true;
    },
     eventpackageTitle:'',   
     eventpackageID:'' 
    }, myRemoteAdapter);

var eventpack = new Eventpack();